﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
namespace EC21_EDiamond
{
    public partial class ThemNguoiDung : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnDongY_Click(object sender, EventArgs e)
        {
            MembershipCreateStatus p = MembershipCreateStatus.Success;
            Membership.CreateUser(txtTaiKhoan.Text, txtMatKhau.Text, txtEmail.Text, null, null, true, out p);
            lblThongBao.Text = p.ToString();
            if (lblThongBao.Text == "Success")
            {
                Roles.AddUserToRole(txtTaiKhoan.Text, drpQuyen.SelectedValue);
                txtTaiKhoan.Text = "";
                txtMatKhau.Text = "";
                txtNhapLaiMatKhau.Text = "";
                txtEmail.Text = "";
                lblThongBao.Text = "";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", "alert('Thêm Thành Công!');", true);  
            }
        }
    }
}